home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7316 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  43 lines

  1. Path: chrism.demon.co.uk!chris
  2. From: Chris Marriott <chris@chrism.demon.co.uk>
  3. Newsgroups: comp.lang.c++,comp.os.ms-windows.programmer.tools.mfc
  4. Subject: Re: Getting functions out of libraries to work
  5. Date: Thu, 22 Feb 1996 17:38:52 +0000
  6. Organization: SkyMap Software
  7. Distribution: world
  8. Message-ID: <s8M9GvAsoKLxEwCk@chrism.demon.co.uk>
  9. References: <312BBC29.6772@uni.massey.ac.nz>
  10. NNTP-Posting-Host: chrism.demon.co.uk
  11. X-NNTP-Posting-Host: chrism.demon.co.uk
  12. MIME-Version: 1.0
  13. X-Newsreader: Turnpike Version 1.11 <xvymwJsTYh8aYs0yGmHsPZXi9Q>
  14.  
  15. In article <312BBC29.6772@uni.massey.ac.nz>, Nigel.Ramsay.1@massey.ac.nz
  16. writes
  17. >I am trying to get some functions out of a library to work. The problem 
  18. >is that I keep getting an "unresolved external" error whenever I try to 
  19. >call the functions.
  20. >
  21. >The funny thing is that it works fine when I compile under just C.
  22. >
  23. >I am using Microsoft Visual C++ 1.0, running under Windows 95.
  24.  
  25. C++ "mangles" names, adding information about argument and return types.
  26. To call a straght C function, change its prototype in your C++ program
  27. from:
  28.  
  29.         int foo( int );
  30.  
  31. to
  32.  
  33.         extern "C" int foo( int );
  34.  
  35. Chris
  36. --------------------------------------------------------------------------
  37.  Chris Marriott, Warrington, UK      | Author of SkyMap v3 award-winning 
  38.  chris@chrism.demon.co.uk            | shareware Win31/Win95 planetarium.
  39.             For full info, see http://www.execpc.com/~skymap  
  40.       Author member of Association of Shareware Professionals (ASP) 
  41. -------------------------------------------------------------------------- 
  42.  
  43.